'use stirct'
let nunjucks = require('nunjucks');



function getEnv(root, opts) {
    root = root || 'views';
    opts = opts || {};
    return nunjucks.configure(root, opts);
}

module.exports = async (ctx, next) => {

    ctx.render = function (views, obj) {
        let env = getEnv();
        ctx.body = env.render(views, obj)
    }
  
    await next();
};
